<template>
    <div >
        <!--//通过按钮来调用-->
        <el-button type="primary" v-print="printObj">打印</el-button>
        <el-button type="primary" @click="prints">打印2</el-button>
        
        <!--//需要打印的页面-->
        <div id="printMe" ref="printContent">
                <div class="hammer">
                    <h3>黄山市机动车排放维修治理（M）站竣工出厂合格证</h3>
                </div>
                <!-- //内容 -->
                <div class="trail">
                    <p>该车经我站治理维护，准予出厂。</p>
                </div>
        </div>
        
    </div>
</template>
<script>

export default {
    name: "print",
    data() {
        return {
            pageList: [],
            status: false,
            printObj: {
                id: "printMe", // 这里是要打印元素的ID
                popTitle: "&nbsp", // 打印的标题
                extraCss: "", // 打印可引入外部的一个 css 文件
                extraHead: "", // 打印头部文字
            },
        }
    },
    created(){
          

        
    },
    methods:{
        prints(){
            console.log(JSON.stringify(this.myUni))
            this.myUni.webView.postMessage({  
                data: {  
                    action: "uni.webView.postMessage",  
                },  
            });
          
        }
    }
}
</script>